<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/index.css">
    <script src="./js/my.js"></script>
</head>

<body>
    <div class="box">
        <div class="box1">
            <h3>全部商品

            </h3>
            <ul>
                <li>男表</li>
                <li>女表</li>
                <li>秒杀</li>
                <li>手表行情</li>
                <li>品牌馆</li>
                <li>体验中心</li>
                <li>名匠维修</li>
                <li>认证二手表</li>
                <li>二手竞拍</li>
                <li>高价回收</li>
                <li>手表质询</li>
                <li>认证开店</li>
            </ul>
        </div>
        <div class="box2">
            <ul>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿



                </li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>
                <li><span class="txt">顶级品牌</span>/百达翡丽 江诗丹顿</li>

                <div class="box3">
                    <h4><span>|</span> 品牌</h4>
                    <div class="imgbox">
                        <img src="images/Snipaste_2021-10-06_11-46-34.jpg" alt="">


                    </div>
                    <div class="img"> <img src="images/Snipaste_2021-10-06_11-46-34.jpg" alt="">
                    </div>

                </div>
                <div class="box4">
                    <img src="images/Snipaste_2021-10-06_12-05-04.jpg" alt="">
                </div>
                <div class="box5">
                    <h4>热词</h4>


                    <ul>
                        <li>
                            <div class="txt2">海马</div>
                        </li>
                        <li>
                            <div class="txt2">纵横七海</div>
                        </li>
                        <li>
                            <div class="txt2">万国小王子</div>
                        </li>
                        <li>
                            <div class="txt2">蓝气球</div>
                        <li>
                            <div class="txt2">水鬼</div>
                        </li>
                        <li>
                            <div class="txt2">历史学家系列</div>
                        </li>
                        <li>
                            <div class="txt2">飞行员表</div>
                        </li>
                    </ul>


                </div>
        </div>
        </ul>

    </div>

    </div>
    <span class="rocket" id="backTop">
        <img src="images/Top.jpg" alt="" />
    </span>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>
    <p>罗总节日快乐</p>



</body>

</html>

<script>
    window.onload = function () {
        var timer = null, leader = 0, target = 0;
        // leader 当前的位置    target 目标位置
        window.onscroll = function () {
            scroll().top > 0 ? show("backTop") : hide("backTop");
            // 如果大于0  就显示  否则 就隐藏
            leader = scroll().top;   // 存储当前的位置
        }
        $("backTop").onclick = function () {
            clearInterval(timer);
            timer = setInterval(function () {
                var step = (target - leader) / 10;
                step = step > 0 ? Math.ceil(step) : Math.floor(step);
                leader = leader + step;
                window.scrollTo(0, leader);   // 去往页面中的某个位置
                console.log(leader);
                if (leader == target) {
                    clearInterval(timer);
                }
            }, 30);
        }
    }
</script>